package com.leetcode.algorithm.y22.m09.w2;

import java.util.Arrays;

/**
 * 2335. 装满杯子需要的最短总时长
 * 
 * https://leetcode.cn/problems/minimum-amount-of-time-to-fill-cups/
 * 
 * @author jie.deng
 *
 */
class Question2335Solution01 {
	
	public int fillCups(int[] amount) {
		Arrays.sort(amount);
		if (amount[0] + amount[1] > amount[2]) {
			return amount[2] + (amount[0] + amount[1] - amount[2] + 1) / 2;
		}
		return amount[2];
	}
    
}